﻿//Created by Action Script Viewer - http://www.buraks.com/asv
package Display.DialogUI {
    import flash.display.*;
    import flash.utils.*;
    import org.aswing.*;
    import Classes.*;
    import org.aswing.geom.*;
    import Display.*;
    import flash.text.*;
    import org.aswing.border.*;
    import Display.aswingui.*;
    import L10n.*;

    public class NewsFlashDialogView extends GenericDialogView {

        private static const SUBHEADER_WIDTH:int = 440;
        private static const SUBHEADER_HEIGHT:int = 54;
        private static const MESSAGE_WIDTH:int = 420;
        private static const MESSAGE_HEIGHT:int = 55;
        private static const TEXT_FIELD_END_GAP:int = 30;

        protected var m_imageURL:Bitmap;
        protected var m_imageAsset:AssetPane;
        protected var m_subheader:String;

        public function NewsFlashDialogView(_arg1:Dictionary, _arg2:String="", _arg3:String="", _arg4:String="", _arg5:int=0, _arg6:Function=null){
            this.m_subheader = _arg4;
            super(_arg1, _arg2, _arg3, _arg5, _arg6);
            this.setLayout(new SoftBoxLayout(SoftBoxLayout.X_AXIS, 0, SoftBoxLayout.CENTER));
        }
        override protected function init():void{
            m_bgAsset = m_assetDict["bg"];
            this.m_imageURL = m_assetDict["imageURL"];
            makeCenterPanel();
            this.makeBackground();
            ASwingHelper.prepare(this);
        }
        override protected function makeBackground():void{
            var _local1:AssetBackground = new AssetBackground(m_bgAsset);
            this.setBackgroundDecorator(_local1);
            this.setPreferredSize(new IntDimension(m_bgAsset.width, m_bgAsset.height));
            this.setMinimumSize(new IntDimension(m_bgAsset.width, m_bgAsset.height));
            this.setMaximumSize(new IntDimension(m_bgAsset.width, m_bgAsset.height));
        }
        override protected function createInteriorHolder():JPanel{
            var _local1:JPanel = ASwingHelper.makeSoftBoxJPanelVertical(SoftBoxLayout.TOP);
            _local1.setPreferredSize(new IntDimension(m_bgAsset.width, (m_bgAsset.height + 50)));
            var _local2:JPanel = ASwingHelper.makeSoftBoxJPanel(SoftBoxLayout.CENTER);
            var _local3:JPanel = ASwingHelper.makeSoftBoxJPanelVertical(SoftBoxLayout.CENTER);
            var _local4:JPanel = ASwingHelper.makeSoftBoxJPanel(SoftBoxLayout.RIGHT);
            var _local5:JButton = ASwingHelper.makeMarketCloseButton();
            _local4.append(_local5);
            _local5.addActionListener(onCancelX, 0, true);
            var _local6:TextFormat = new TextFormat();
            _local6.bold = true;
            _local1.append(_local4);
            _local3.setMinimumHeight((SUBHEADER_HEIGHT + MESSAGE_HEIGHT));
            _local3.setPreferredHeight((SUBHEADER_HEIGHT + MESSAGE_HEIGHT));
            _local3.setMaximumHeight((SUBHEADER_HEIGHT + MESSAGE_HEIGHT));
            var _local7:JPanel = ASwingHelper.makeSoftBoxJPanel(SoftBoxLayout.CENTER);
            var _local8:JPanel = ASwingHelper.makeSoftBoxJPanelVertical(SoftBoxLayout.BOTTOM);
            var _local9:AssetPane = ASwingHelper.makeMultilineText(this.m_subheader, SUBHEADER_WIDTH, EmbeddedArt.DEFAULT_SERIF_FONT, TextFormatAlign.CENTER, 29, EmbeddedArt.darkGreyTextColor, null, true);
            var _local10:TextField = (_local9.getAsset() as TextField);
            _local10.setTextFormat(_local6);
            LocaleHelper.localSetting.TextField_adjust(_local10, {
                embedFonts:false,
                font:EmbeddedArt.SYSTEM_FONT
            });
            TextFieldUtil.autosize(_local10, (SUBHEADER_WIDTH - TEXT_FIELD_END_GAP), SUBHEADER_HEIGHT);
            _local9.setPreferredHeight(_local10.height);
            _local9.setPreferredWidth(440);
            ASwingHelper.setEasyBorder(_local8, 0, 0, 0, 15);
            _local8.append(_local9);
            _local7.append(_local8);
            var _local11:TextFormat = new TextFormat();
            _local11.align = TextFormatAlign.CENTER;
            var _local12:JPanel = ASwingHelper.makeSoftBoxJPanel(SoftBoxLayout.CENTER);
            var _local13:JPanel = ASwingHelper.makeSoftBoxJPanelVertical(SoftBoxLayout.TOP);
            var _local14:JTextField = ASwingHelper.makeTextField(m_message, EmbeddedArt.DEFAULT_SERIF_FONT, 21, EmbeddedArt.darkGreyTextColor, 0, _local11);
            LocaleHelper.localSetting.TextField_adjust(_local14.getTextField(), {
                embedFonts:false,
                font:EmbeddedArt.SYSTEM_FONT
            });
            TextFieldUtil.autosize(_local14.getTextField(), (MESSAGE_WIDTH - TEXT_FIELD_END_GAP), MESSAGE_HEIGHT);
            _local14.setPreferredWidth(420);
            ASwingHelper.setEasyBorder(_local13, 0, 0, 0, 15);
            _local13.append(_local14);
            _local12.append(_local13);
            ASwingHelper.prepare(_local14);
            ASwingHelper.prepare(_local9);
            var _local15:Number = Math.max(8, (80 - (_local14.getTextField().textHeight + _local9.getHeight())));
            _local3.append(ASwingHelper.verticalStrut(_local15));
            _local3.append(_local7);
            _local3.append(_local12);
            ASwingHelper.prepare(_local3);
            _local2.append(_local3);
            _local2.setMinimumHeight(125);
            _local2.setPreferredHeight(125);
            _local2.setMaximumHeight(125);
            _local1.append(ASwingHelper.verticalStrut(10));
            _local1.append(_local2);
            this.m_imageAsset = new AssetPane(this.m_imageURL);
            this.m_imageAsset.setBorder(new EmptyBorder(null, new Insets(0, 8, 0, 0)));
            _local1.append(this.m_imageAsset);
            m_acceptTextName = ZLoc.t("Dialogs", "ShareTheNews");
            var _local16:JPanel = super.createButtonPanel();
            _local1.append(ASwingHelper.verticalStrut(-20));
            _local1.append(_local16);
            ASwingHelper.prepare(_local1);
            return (_local1);
        }

    }
}//package Display.DialogUI 
